<html>
<head><meta charset="utf-8"><title>aligning const and const fn? · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html">aligning const and const fn?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="167265609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167265609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167265609">(Jun 04 2019 at 07:33)</a>:</h4>
<p>Is there a timeline for aligning the abilities of <code>const</code> and <code>const fn</code> so that these are not covered by two different checks (const_qualif vs min_const) any more?</p>



<a name="167281581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167281581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167281581">(Jun 04 2019 at 11:10)</a>:</h4>
<p>not that I know of. Note that <code>const fn</code> is <code>const_qualif + min_const</code>, so essentially the work is to eliminate <code>min_const</code></p>



<a name="167281739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167281739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167281739">(Jun 04 2019 at 11:13)</a>:</h4>
<p>yes</p>



<a name="167281745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167281745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167281745">(Jun 04 2019 at 11:13)</a>:</h4>
<p>for example <code>min_const</code> contains another intrinsic whitelist and I am not sure why that is there (as opposed to in <code>const_qualif</code>)</p>



<a name="167281801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167281801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167281801">(Jun 04 2019 at 11:14)</a>:</h4>
<p>do we not want to allow the same intrinsics in stable <code>const fn</code> and <code>const</code>?</p>



<a name="167292381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167292381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167292381">(Jun 04 2019 at 13:25)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> It does seems like we should -- so the whitelist should be moved?</p>



<a name="167292389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167292389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167292389">(Jun 04 2019 at 13:25)</a>:</h4>
<p>or just used in <code>const_qualif</code></p>



<a name="167292405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167292405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167292405">(Jun 04 2019 at 13:25)</a>:</h4>
<p>(latter is my preference)</p>



<a name="167293424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167293424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167293424">(Jun 04 2019 at 13:35)</a>:</h4>
<p>hm I may have misunderstood what that file is even about</p>



<a name="167293492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167293492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167293492">(Jun 04 2019 at 13:36)</a>:</h4>
<p>the main difference between stable <code>const</code> and <code>const fn</code> AFAIK is access to union fields, but that check is in <code>qualify_consts</code>. all the stuff in min_const should apply to everything on stable, not just functions.</p>



<a name="167293594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167293594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167293594">(Jun 04 2019 at 13:36)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span>  FP math as well iirc</p>



<a name="167293670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167293670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167293670">(Jun 04 2019 at 13:37)</a>:</h4>
<p>casts to function pointers and trait objects</p>



<a name="167293674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167293674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167293674">(Jun 04 2019 at 13:37)</a>:</h4>
<p>I feel I should know this by heart but I have amnesia about stable <code>const fn</code></p>



<a name="167293705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167293705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167293705">(Jun 04 2019 at 13:37)</a>:</h4>
<p><span class="user-mention" data-user-id="116118">@Matthew Jasper</span>  <span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span></p>



<a name="167293876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167293876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167293876">(Jun 04 2019 at 13:39)</a>:</h4>
<p>the cast and arithmetic checks <em>are</em> in <code>min_const</code></p>



<a name="167293898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/aligning%20const%20and%20const%20fn%3F/near/167293898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/aligning.20const.20and.20const.20fn.3F.html#167293898">(Jun 04 2019 at 13:39)</a>:</h4>
<p>but they are also duplicated in <code>qualify_consts</code> for promotion^^</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>